/**
 * 编辑-入库主表js
 */
/*
$(function () {
	$('#select2Id').selectBindEx({
		url: "/sys/macro/value?value=供应商",
		async: true,
		text: 'name',
		value: 'macroId',
		placeholder: '请选择供应商...',
		selected: '',
		allowClear: false,
		theme: "bootstrap",
		language: "zh-CN",
		change: function(){}
	});

/!*	$('#select2Type').selectBindEx({
		url: "/sys/macro/value?value=入库类型",
		async: true,
		text: 'name',
		value: 'macroId',
		placeholder: '入库类型...',
		selected: '',
		allowClear: false,
		theme: "bootstrap",
		language: "zh-CN",
		change: function(){}
	});*!/

	$('#select2Type').selectBindEx({
		url: "/sys/macro/value?value=入库类型",
		async: true,
		text: 'name',
		value: 'macroId',
		placeholder: '请选择入库类型...',
		selected: '',
		allowClear: false,
		theme: "bootstrap",
		language: "zh-CN",
		change: function(){
			vm.inTypeCode = $("#select2Type option:selected").val();
			//vm.inTypeCode =inBound.inTypeName;
		}
	});

	$('#select2Dept').selectBindEx({
		url: "/sys/macro/value?value=库房",
		async: true,
		text: 'name',
		value: 'macroId',
		placeholder: '请选择入库库房...',
		selected: '',
		allowClear: false,
		theme: "bootstrap",
		language: "zh-CN",
		change: function(){}
	});

	$('#select2Item').selectBindEx({
		url: "/sys/macro/value?value=项目",
		async: true,
		text: 'name',
		value: 'macroId',
		placeholder: '请选择项目...',
		selected: '',
		allowClear: false,
		theme: "bootstrap",
		language: "zh-CN",
		change: function(){}
	});

});*/


var vm = new Vue({
	el:'#dpLTE',
	data: {
		inBound: {
			id: 0,
			supplier:'0',
			inTypeCode:'0',
			inDeptCode:'0',
			inItemCode:'0'
		},
		optionsSupplier: [],
		optionsInType: [],
		optionsInDept: [],
		optionsInItem: [],
	},
	methods : {
		setForm: function() {
			$.SetForm({
				url: '../../inbound/info?_' + $.now(),
		    	param: vm.inBound.id,
		    	success: function(data) {
		    		vm.inBound = data;

		    	}
			});
		},
		acceptClick: function() {
			if (!$('#form').Validform()) {

		        return false;
		    }
		    $.ConfirmForm({
		    	url: '../../inbound/update?_' + $.now(),
		    	param: vm.inBound,
		    	success: function(data) {
		    		$.currentIframe().vm.load();
		    	},
		    });
		},
		getSupplier: function () {
			$.getJSON("/sys/macro/value?_" + $.now() + "&value=供应商", function (r) {
				vm.optionsSupplier = r;
			});
		},
		getInType: function () {
			$.getJSON("/sys/macro/value?_" + $.now() + "&value=入库类型", function (r) {
				vm.optionsInType = r;
			});
		},
		getInDept: function () {
			$.getJSON("/sys/macro/value?_" + $.now() + "&value=库房", function (r) {
				vm.optionsInDept = r;
			});
		},
		getInItem: function () {
			$.getJSON("/sys/macro/value?_" + $.now() + "&value=项目", function (r) {
				vm.optionsInItem = r;
			});
		},
	}
})
vm.getSupplier();
vm.getInType();
vm.getInDept();
vm.getInItem();